#include<iostream>
#include<stdio.h>

#include <iomanip>
#include  <cmath>
#include <stdlib.h>
#include <cstring>
#include <malloc.h>
#include<stdio.h>
#include<cassert>
#include <stdio.h>
using namespace std;
int main() {
    int n = 0;
    int m = 0;
    cin >> n >> m;
    int arr1[1000];
    int arr2[1000];
    int i = 0;
    for (i = 0; i < n; i++)
    {
        cin >> arr1[n];
    }
    for (i = 0; i < m; i++)
    {
        cin >> arr2[m];
    }
    int arr3[2000];
    int j = 0;
    i = 0;
    int k = 0;
    while (i < n && j < m)
    {
        if (arr1[i] < arr2[j])
        {
            arr3[k++] = arr1[i++];
        }
        else
        {
            arr3[k++] = arr2[j++];
        }

    }
    if (i == n) {
        while (j < m)
        {
            arr3[k++] = arr2[j++];
        }
    }
    else
    {
        while (i < n)
        {
            arr3[k++] = arr1[i++];


        }
    }
    for (i = 0; i < n; i++)
    {
        cout << arr3[i];
    }
}